﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using vITs.Site.Models.DataModels;

namespace vITs.Site.Models.ActionModels
{
    public class AddTripModel
    {
        [Required]
        public int AssignmentId { get; set; }

        [Display(Name="Avgångsplats")]
        [StringLength(50, MinimumLength=3, ErrorMessage="Ett platsnamn måste vara mellan 3 och 50 tecken.")]
        public string StartLocation { get; set; }

        [Display(Name="Startdatum")]
        public DateTime StartDate { get; set; }

        [Display(Name="Destination")]
        [StringLength(50, MinimumLength = 3, ErrorMessage = "Ett platsnamn måste vara mellan 3 och 50 tecken.")]
        public string EndLocation { get; set; }

        [Display(Name="Slutdatum")]
        public DateTime EndDate { get; set; }

        [Display(Name="Transportmedel")]
        [Required]
        public TransportationMode TransportationMode { get; set; }

        [Display(Name="Transportkostnad")]
        [Range(float.Epsilon, float.MaxValue, ErrorMessage="Du måste ange ett positivt tal.")]
        public float TransportationCost { get; set; }

        public IEnumerable<TripAccountModel> Accounts { get; set; }
    }

    public class TripAccountModel
    {
        [Required]
        public Int32 Id { get; set; }

        [Required]
        public Int32 Percentage { get; set; }
    }
}